package com.aaa.three.controller;

import com.aaa.three.entity.AddReg;
import com.aaa.three.service.PayService;
import com.alipay.api.AlipayApiException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @PACKAGE_NAME: com.aaa.three.controller
 * @NAME: PayController
 * @USER: Tprairie
 * @DATE: 2022/2/22
 * @PROJECT_NAME: three
 */
@Controller
@RequestMapping("/si")
public class PayController {
    @Autowired
    private PayService payServiceImpl;
    @RequestMapping("/play")
    @ResponseBody
    public String payPat(Integer aid,Integer dateid,Integer day,Integer state)throws AlipayApiException {
        AddReg addReg = new AddReg();
        addReg.setAid(aid);
        addReg.setDateid(dateid);
        addReg.setDay(day);
        addReg.setState(state);
        return payServiceImpl.payPat(addReg);
    }
    @RequestMapping("/pay")
    @ResponseBody
    public String payAgain(Integer id,Integer price) throws AlipayApiException {
        return payServiceImpl.payAgain(id,price);
    }
    @RequestMapping("/out")
    @ResponseBody
    public void outPay(Integer id, Integer price, HttpServletResponse response) throws Exception {
         payServiceImpl.outPay(id,price,response);
    }
}
